﻿<html style="overflow: hidden;">
<head>
<meta charset="utf-8" >
<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<meta name="x5-fullscreen" content="true">
<meta name="full-screen" content="yes">

<title>{$room.roomid}号十二人房间</title>

<link rel="stylesheet" type="text/css" href="/app/css/bull_vue-1.0.4.css">
<link rel="stylesheet" type="text/css" href="/app/css/alert-1.1.css">
<link rel="stylesheet" type="text/css" href="/app/css/bullshop-1.0.css">
<link rel="stylesheet" type="text/css" href="/app/css/public.css">
<link rel="stylesheet" type="text/css" href="/app/css/public12.css">
 <!-- <link rel="stylesheet" href="/app/css/app.css" />  -->
<style>
  .mainPart{
    position: relative;
    height: auto;
  }
  .alert .mainPart .id{
    position: relative;
  }
.alert .mainPart .alertText{
  position: relative;
}

.alert .mainPart{
  height: auto;
}
 .lishijilu{
         position: relative;background:url(http://goss.fexteam.com/files/images/common/alert3.png) 0% 0% / 100% 100% no-repeat;width: 82%;margin-left: 3.5vh;color: black;/* margin: auto; */margin-top: 2vh;height: 9vh;line-height: 4vh;font-size: 15px;border-radius: 6px;padding-left: 10px;padding-top: 1vh;
    }
@media screen and (max-width: 320px) {
    .lishijilu{
         position: relative;background: #a2befc;width: 82%;margin-left: 3.5vh;color: black;/* margin: auto; */margin-top: 2vh;height: 9vh;line-height: 4vh;font-size: 12px;border-radius: 6px;padding-left: 10px;padding-top: 1vh;
    }

}

</style>
<script src="/app/js/homepage/jq.js" type="text/javascript"></script> 
<script src="/app/js/fastclick.js" type="text/javascript"></script> 
<script src="/app/js/homepage/home.js" type="text/javascript"></script> 
<script src="/app/js/app.js" type="text/javascript"></script>
<script src="/app/js/game10.js" type="text/javascript"></script> 
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js" type="text/javascript"></script>


<script>
$(function() {  
    FastClick.attach(document.body);  
});  
  var url =window.location.href;//用户要分享的网址
  var title  = '熟人十二人牛牛(房间号:{$room.roomid})';//分享的标题
  var shareimg = 'http://'+window.location.hostname+'/app/home.jpg';//分享的图片
  var desc = '模式{$room['wfname']}<if condition="$room['df']">底分：{$room['df']}</if><if condition="$room['gz']">规则： {$room['gz']}</if> <if condition="$room['px']">牌型： <foreach name="room['px']" item="one">{$one}</foreach> </if> <if condition="$room['sz']">上庄{$room['sz']}</if> ';//分享的描述信息
  WeChat(url,title,shareimg,desc);
</script>

</head>

<html>
 <head></head>
 <body style="overflow: hidden;"> 
 <img src="/app/bg.png" style="display: none">
<img src="/app/dyj.png" style="display: none">
    <div id="overtime" style="display: none">
    <canvas id="myCanvas" width="800" height="1297" style="display: none"></canvas>
    </div>
<if condition="$room['endtime'] gt 0">
   <php>
      $mapxx=array();
      $mapxx['uid']=$user['id'];
      $mapxx['room']=$room['id'];

      if(M('user_room')->where($mapxx)->find()){
  </php>
    <script type="text/javascript">
        var data={};
        data.id={$room['roomid']};
        data.zjs={$room['zjs']};
        data.time='{$room['time']|date="Y-m-d H:i:s",###}';
        data.user={$room['overxx']};
        <php>
              $overxx=json_decode($room['overxx'],true);
              foreach($overxx as $key=>$value){
                    $nickname=usernickname($value[id]);
                    echo 'data.user["'.$key.'"]["nickname"]="'.$nickname.'";';
              }
              $fangzhu=M('user')->find($room['uid']);
        </php>
        data.fangzhu=[];
        data.fangzhu.nickname='{$fangzhu.nickname}';
        overroom(data);
    </script>

   <php>
     }
     else{
  </php>
  <script type="text/javascript">
    document.title = '温馨提示';
  </script>
  <div id="valert2" class="alert">
   <div class="alertBack" style="opacity: 1;"></div> 
   <div class="mainPart" style="height: 27%;margin-top: -113.39px;">
    <div class="backImg">
     <div class="blackImg" style="height: 82%;"></div>
    </div> 
    <div class="alertText" style="top: 45%;" id="tipmsg">房间已经关闭</div> 
     
     
   </div>
  </div>
  <php>
      }
      exit();
  </php>
</if>


<if condition="$fzuser['sfgl']  && (!$mayuser[$user['id']])">
    <script type="text/javascript">
    document.title = '温馨提示';
  </script>
<div id="valert2" class="alert">
   <div class="alertBack" style="opacity: 1;"></div> 
   <div class="mainPart" style="height: 27%;margin-top: -113.39px;">
    <div class="backImg">
     <div class="blackImg" style="height: 82%;"></div>
    </div> 
    <div class="alertText" style="top: 45%;" id="tipmsg">无法加入，请联系管理员。</div> 
     
     
   </div>
  </div>

  <php>
      exit();
  </php>
</if>


      <div class="roomCard">
    <img src="/app/img/game/roomCard.png" /> 
    <div class="num">
     <div class='shier-fk'></div> 
     <div class='shier-fk-1' id="fknum">{$user['fk']}张</div>
    </div>
   </div>

   <img src="/app/img/bull9/tab_bottom.png" alt="" class="tabBottom" /> 
   <div class="round shier-round" style="" id="jsxx">
    {$room.js}&nbsp;/&nbsp;{$room.zjs}局
   </div> 

   <img src="/app/img/bull9/btn_game_home.png" class="return"  onclick="opnemm('fangjian_fanhuisy','tishi')" /> 
   <img src="/app/img/common/note5.png" class="return shier-return" onclick="opnemm('fangjian_tishi','tishi')"/> 
   <img src="/app/img/bull9/btn_game_rule.png" class="bGameRule shier-bGameRule" onclick="opnemm('fangjian_gz','vroomRule')" /> 

   <div class="myCardTypeBG"></div> 
   <div class="myCardType" style="overflow: hidden;">
    <div id="df" style="
    overflow: hidden;
">
     底分：{$room.df}
    </div>
   </div> 
   <div class="bottomMessage"  onclick="opnemm('fangjian_kj','message')">
    <img src="/app/img/bull9/bull_message.png" class='shier-bottomMessage-img'  />
   </div> 
   <div class="bottomHistory shier-bottomHistory" onclick="opnemm('fangjian_yinyue','vaudioRoom')">
    <img class='shier-bottomHistory-img' src="/app/img/common/icon_sound91.png"/>
   </div> 

  <div id="messageSay">
  </div>
  <div id="tishi" class="alert" style="display: none;"></div>   
  <div id="vaudioRoom" class="audioRoom" style="display: none;"></div> 
  <div id="vroomRule" class="createRoom" style="display: none;"></div>
  <div id='message' class="message" style="
    display: none;overflow: hidden;
"></div> 

   <div id="table" class="table">
    <img src="/app/img/bull12/back.jpg" class="tableBack" /> 
    <div class="cardDeal" id="userfp"></div> 


     <div class="myCards" style="display: none;"></div>


  <div class="myCards" style="display: none;"></div>

 <div class="myCards" style="display: none;"></div>



    <div class="cardOver" style="position: absolute; width: 100%; height: 100%; overflow: hidden;"></div> 

    <div id="memberTimesText"></div> 
    <div id="memberTimesText2"></div> 
    
    <div id="memberRobText"></div>
    <div id="memberFreeRobText"></div>
    <div id="memberBull"></div>
    

    <div id="memberScoreText1"></div>
    
    <div id="member"></div> 


    <div id="jinbi"></div> 


    <div>
      <div class="triangle"></div>
    </div>


    <div id="divRobBankerText" class='shier-qiangzhuang'></div> 
    <div id="" class="clock shier-clock">
     <img src="/app/img/bull9/bull_clock.png" class='shier-memberCoin' /> 
     <p id='djs' class='shier-clock1'> 10 </p>
    </div> 

    <div id="operationButton">
    </div>

    <div class='gongg' style="display: none">
    </div>
    
    </div>

 <script>
    function joinroom(){
      $("#valert").remove();
      token='{$token}';
      room='{$room.id}';
      var dkxx='{$room.dk}';
     load('show');
     if(dkxx){
      connect(dkxx);
    }
    else{
      load('hide');
      prompt('服务器没开启,请稍后再试');
      setTimeout("$('body').hide()",3000);
    }
    }
  </script>
<if condition="count($room['userlist']) egt 12 && $room['userlist'][$user['id']] neq 1">
<div id="valert2" class="alert">
   <div class="alertBack"></div> 
   <div class="mainPart" style="height: 31%;margin-top: -113.39px;">
    <div class="backImg">
     <div class="blackImg" style=" height: 59%;"></div>
    </div> 
    <div class="alertText" style="top: 35%;" id="tipmsg">房间人数已满</div> 
     <div class="buttonRight" style="left: 31.5%;width: 17vh;height: 5.5vh;" onclick="location.href='/'">
     返回首页
    </div>
     
   </div>
  </div>

  <php>
      exit();
  </php>
</if>
<if condition="(count($room['userlist']) gt 0 && $room['js'] eq 0) || ($room['js'] gt 0 && !$room['userlist'][$user['id']])">
  <div id="valert" class="alert">
   <div class="alertBack"></div> 
   <div class="mainPart" style="margin-top: -34vh;">
    <div class="backImg">
     <div class="blackImg" style=" height: 77%;"></div>
    </div> 
    <div class="id">
     <img src="/app/img/ID.png" /> 
     <div class="text">
       你的{$titlexx}ID:{$user.id} 
     </div>
    </div>
    <php>
      $count=M('user_room')->where(array('uid'=>$user['id'],'type'=>$room['type']))->count();
      $count=$count+0;
      $max=M('user_room')->where(array('uid'=>$user['id'],'type'=>$room['type']))->order('jifen desc')->find();
    </php> 
    <div class='lishijilu' style="">
    <div>历史最高分：<if condition="$max">{$max.jifen} ({$max.overtime|date="m-d H:i",###})<else/>暂无游戏记录</if></div>  
    <div>游戏总局数：{$count}</div> 
    </div>
    <div class="alertText" style="top: 1vh;">
     <div class="rull" style="font-size: 2.2vh;">
       模式
      <a>{$room['wfname']}</a> <br />
      <if condition="$room['df']">
       底分：
      <a>{$room['df']}</a> 
      <br /> 
      </if>
      <if condition="$room['gz']">
      规则： 
      <a>{$room['gz']}</a> 
      <br />
      </if> 
      <if condition="$room['px']">
       牌型： 
      <a><foreach name="room['px']" item="one">{$one}</foreach></a> 
      <br />
      </if> 

      <if condition="$room['sz']">
      上庄： 
      <a>{$room['sz']}</a> 
      <br />
      </if> 
            
       局数： 
      <a>{$room['zjs']}局X{$room['fk']}房卡 </a> 

     </div> 
     <div style="margin-bottom: 9.5vh;
    position: relative;">
      房间中有<php>
          foreach($room['userlist'] as $key=>$one){
          if(!$indexxx)
          {
          $indexxx=1;
          }
          else{
          echo ',';
          }
          echo username($key);
          }
      </php>,是否加入？
     </div>
    </div> 
    
    <div style="position: relative;
    width: 100%;
    height: 5vh;
        top: -3vh;">
     <div class="buttonLeft" onclick="location.href='/'" style="    top: 0;
    bottom: 0;
    margin: auto;">
      创建房间
     </div> 
     <div class="buttonRight" onclick="joinroom()" style="   top: 0;
    bottom: 0;
    margin: auto;">
      加入游戏
     </div>
   </div>
  </div> 
</div>
<else/>
<script>
  joinroom();
</script>
</if> 







<audio onended="mp3playandpause('1miao');" id="1miao" src="/app/video/1miao.mp3"></audio>
<audio onended="mp3playandpause('mp3niu0');" id="mp3niu0" src="/app/video/nan_niu0.mp3"></audio>
<audio onended="mp3playandpause('mp3niu1');" id="mp3niu1" src="/app/video/nan_niu1.mp3"></audio>
<audio onended="mp3playandpause('mp3niu2');" id="mp3niu2" src="/app/video/nan_niu2.mp3"></audio>
<audio onended="mp3playandpause('mp3niu3');" id="mp3niu3" src="/app/video/nan_niu3.mp3"></audio>
<audio onended="mp3playandpause('mp3niu4');" id="mp3niu4" src="/app/video/nan_niu4.mp3"></audio>
<audio onended="mp3playandpause('mp3niu5');" id="mp3niu5" src="/app/video/nan_niu5.mp3"></audio>
<audio onended="mp3playandpause('mp3niu6');" id="mp3niu6" src="/app/video/nan_niu6.mp3"></audio>
<audio onended="mp3playandpause('mp3niu7');" id="mp3niu7" src="/app/video/nan_niu7.mp3"></audio>
<audio onended="mp3playandpause('mp3niu8');" id="mp3niu8" src="/app/video/nan_niu8.mp3"></audio>
<audio onended="mp3playandpause('mp3niu9');" id="mp3niu9" src="/app/video/nan_niu9.mp3"></audio>
<audio onended="mp3playandpause('mp3niu10');" id="mp3niu10" src="/app/video/nan_niuniu.mp3"></audio>
<audio onended="mp3playandpause('mp3niu11');" id="mp3niu11" src="/app/video/nan_wuhua.mp3"></audio>
<audio onended="mp3playandpause('mp3niu12');" id="mp3niu12" src="/app/video/nan_zha.mp3"></audio>
<audio onended="mp3playandpause('mp3niu13');" id="mp3niu13" src="/app/video/nan_wuxiao.mp3"></audio>

<audio onended="mp3playandpause('mp3daojishi');" id="mp3daojishi" src="/app/video/daojishi.mp3"></audio>
<audio onended="mp3playandpause('mp3gold');" id="mp3gold" src="/app/video/gold.mp3"></audio>
<audio onended="mp3playandpause('mp3kaiju');" id="mp3kaiju" src="/app/video/kaiju.mp3"></audio>
<audio onended="mp3playandpause('mp3xiazhu');" id="mp3xiazhu" src="/app/video/xiazhu.mp3"></audio>
<audio onended="mp3playandpause('mp3fapai');" id="mp3fapai" src="/app/video/fapai.mp3"></audio>

<audio onended="mp3playandpause('message1');" id="message1" src="/app/message/message1.mp3"></audio>
<audio onended="mp3playandpause('message2');" id="message2" src="/app/message/message2.mp3"></audio>
<audio onended="mp3playandpause('message3');" id="message3" src="/app/message/message3.mp3"></audio>
<audio onended="mp3playandpause('message4');" id="message4" src="/app/message/message4.mp3"></audio>
<audio onended="mp3playandpause('message5');" id="message5" src="/app/message/message5.mp3"></audio>
<audio onended="mp3playandpause('message6');" id="message6" src="/app/message/message6.mp3"></audio>
<audio onended="mp3playandpause('message7');" id="message7" src="/app/message/message7.mp3"></audio>
<audio onended="mp3playandpause('message8');" id="message8" src="/app/message/message8.mp3"></audio>
<audio onended="mp3playandpause('message9');" id="message9" src="/app/message/message9.mp3"></audio>
<audio onended="mp3playandpause('message10');" id="message10" src="/app/message/message10.mp3"></audio>
<audio onended="mp3playandpause('message11');" id="message11" src="/app/message/message11.mp3"></audio>


<audio id="background" src="/app/video/background.mp3" ></audio>
<!--下注抢庄-->
<audio onended="mp3playandpause('xia1');" id="xia1" src="/app/video/zhuang/1.mp3"></audio>
<audio onended="mp3playandpause('xia2');" id="xia2" src="/app/video/zhuang/2.mp3"></audio>
<audio onended="mp3playandpause('xia4');" id="xia4" src="/app/video/zhuang/4.mp3"></audio>
<audio onended="mp3playandpause('xia5');" id="xia5" src="/app/video/zhuang/5.mp3"></audio>
<audio onended="mp3playandpause('qiangzhuang');" id="qiangzhuang" src="/app/video/zhuang/qiangzhuang.mp3"></audio>
<audio onended="mp3playandpause('buqiang');" id="buqiang" src="/app/video/zhuang/buqiang.mp3"></audio>

<script>




function over(msg){
  var html='<div id="valert2" class="alert">';
  html=html+'<div class="alertBack"></div> '; 
  html=html+'<div class="mainPart" style="height: 31%;margin-top: -113.39px;">'; 
  html=html+'<div class="backImg">'; 
  html=html+'<div class="blackImg" style="height: 59%;"></div>'; 
  html=html+'</div> '; 
  html=html+'<div class="alertText" style="top: 35%;" id="tipmsg">'+msg+'</div>'; 
  html=html+'<div class="buttonRight" style="left: 31.5%;width: 17vh;height: 5.5vh;" onclick="location.href='/'">返回首页</div> </div></div>'; 
  $('body').html(html);
}
var overscroll = function(el) {
  el.addEventListener('touchstart', function() {
    var top = el.scrollTop
      , totalScroll = el.scrollHeight
      , currentScroll = top + el.offsetHeight;
    //If we're at the top or the bottom of the containers
    //scroll, push up or down one pixel.
    //
    //this prevents the scroll from "passing through" to
    //the body.
    if(top === 0) {
      el.scrollTop = 1;
    } else if(currentScroll === totalScroll) {
      el.scrollTop = top - 1;
    }
  });
  el.addEventListener('touchmove', function(evt) {
    //if the content is actually scrollable, i.e. the content is long enough
    //that scrolling can occur
    if(el.offsetHeight < el.scrollHeight)
      evt._isScroller = true;
  });
}
document.body.addEventListener('touchmove', function(evt) {
  //In this case, the default behavior is scrolling the body, which
  //would result in an overflow.  Since we don't want that, we preventDefault.
  if(!evt._isScroller) {
    evt.preventDefault();
  }
});

var context = new (window.AudioContext || window.webkitAudioContext)();
var source = [];
var audioBuffer = [];

    function mp3play(id){
      if(id!='background' &&　mp3open==2){
        return false;
      }
        //document.getElementById(id).play();
        if(!audioBuffer[id]){
           loadAudioFile(id);
        }
        if(source[id]){
           if(typeof(source[id].stop)=='function'){
             source[id].stop();
           }
          source[id]=null;
        }
        source[id] = context.createBufferSource();
        source[id].buffer = audioBuffer[id];
        if(id=='background'){
            source[id].loop = true;
        }
        else{
          source[id].loop = false;
        }
        source[id].connect(context.destination);
        source[id].start(0); //立即播放
    }
    function mp3pause(id){
        //document.getElementById(id).pause();
        if (source[id]) {
          source[id].loop = false;
          source[id].stop(); //立即停止
          source[id]=null;
        }
    }

    function mp3playandpause(id){
        mp3play(id);
        mp3pause(id);
    }


function initSound(arrayBuffer,id) {
    context.decodeAudioData(arrayBuffer, function(buffer) { //解码成功时的回调函数
        audioBuffer[id] = buffer;
    }, function(e) { //解码出错时的回调函数
        console.log('Error decoding file', e);
    });
}


function loadAudioFile(id) {
    var url=$('#'+id).attr('src');
    var xhr = new XMLHttpRequest(); //通过XHR下载音频文件
    xhr.open('GET', url, true);
    xhr.responseType = 'arraybuffer';
    xhr.onload = function(e) { //下载完成
        initSound(this.response,id);
    };
    xhr.send();
}


    function audioAutoPlay(id){
        loadAudioFile(id);
    }

function muiscready(){
    audioAutoPlay('mp3niu0');
    audioAutoPlay('mp3niu1');
    audioAutoPlay('mp3niu2');
    audioAutoPlay('mp3niu3');
    audioAutoPlay('mp3niu4');
    audioAutoPlay('mp3niu5');
    audioAutoPlay('mp3niu6');
    audioAutoPlay('mp3niu7');
    audioAutoPlay('mp3niu8');
    audioAutoPlay('mp3niu9');
    audioAutoPlay('mp3niu10');
    audioAutoPlay('mp3niu11');
    audioAutoPlay('mp3niu12');
    audioAutoPlay('mp3niu13');
    audioAutoPlay('background');

    audioAutoPlay('mp3daojishi');
    audioAutoPlay('mp3gold');
    audioAutoPlay('mp3kaiju');
    audioAutoPlay('mp3xiazhu');

    audioAutoPlay('mp3fapai');



    audioAutoPlay('message1');
    audioAutoPlay('message2');
    audioAutoPlay('message3');
    audioAutoPlay('message4');
    audioAutoPlay('message5');
    audioAutoPlay('message6');
    audioAutoPlay('message7');
    audioAutoPlay('message8');
    audioAutoPlay('message9');
    audioAutoPlay('message10');
    audioAutoPlay('message11');


    audioAutoPlay('xia1');
    audioAutoPlay('xia2');
    audioAutoPlay('xia4');
    audioAutoPlay('xia5');
    audioAutoPlay('qiangzhuang');
    audioAutoPlay('buqiang');
if(bgmp3open==1){
setTimeout(function(){
    mp3pause('background');
    mp3play('background');
},2000)
}
 if(bgmp3open==2){
     mp3pause('background');
  }
}

        

// document.addEventListener("WeixinJSBridgeReady", function () {
//           mp3play('background');
// }, false);
// document.addEventListener('YixinJSBridgeReady', function() {
//           mp3play('background');      
// }, false);




function onBridgeReady(){
 WeixinJSBridge.invoke('getNetworkType',{},
    function(e){
        //WeixinJSBridge.log(e.err_msg);
         mp3play('1miao');  
      });
}

if (typeof WeixinJSBridge == "undefined"){
    if( document.addEventListener ){
        document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
    }else if (document.attachEvent){
        document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
        document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
    }
}else{
    onBridgeReady();
}


muiscready();

</script>


 </body>
</html>
